home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 4.3 KB | 123 lines |
- ' ************************************* Commands used:
- ' * * Set Rain Colour
- ' * Amcaf Examples *
- ' * Set Rain Colour 3 V1.0 *
- ' * Written by Chris Hodges *
- ' * *
- ' *************************************
- '
- ' *** WARNING!!! ***
- ' This program will only work, if the AMOSPro.Lib Patch has been installed.
- ' Otherwise you'll get a very nice black screen.
- '
- ' First, hide the mouse cursor for niceness.
- Hide
- ' Unpack a neat little 4 coloured antialiased font onto a screen.
- Unpack 16 To 0 : Screen Hide
- ' Pack the letters into blocks, as they are more handy and faster for this
- ' special usage.
- For A=0 To 58
- Get Block A+1,(A mod 20)*16,(A/20)*16,16,16
- Next
- ' Open a overscanned, oversized screen. This screen is 64 pixels taller than
- ' the double of the viewable display height.
- Screen Open 0,352,576,4,0
- Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
- ' Set the right palette for the font.
- Palette 0,$FFF,$999,$555
- ' Bring the screen into the right place.
- Screen Display 0,104,40,352,256
- ' Reset the y scroll position.
- YPOS=0
- ' And set the offset to the right value.
- Screen Offset 0,0,YPOS+24
- ' Define some scrolltext. Note the use of the dollar symbol as line-seperator.
- T$="THIS IS$$A$$SUPER$SOFT$SCROLLER$$$IT WAS ARCHIEVED$USING AN$$"
- T$=T$+"INTERLACE TRICK!$$$$$$SOMEWHAT SMOOTH, EH?$$$$$$$$"
- ' Now here comes the tricky part.
- ' We reserve a little rainbow, whichs sets the BPLCON0 register.
- ' This register contains the display mode an colours.
- ' A normal 4-coloured lowres screen has following value:
- ' BPLCON0=$2200. $4 turns the interlace mode on. If we set on interlace
- ' we can double the lines.
- ' A interlace screen consists of a long frame (which has 313 raster lines) and
- ' a short frame (whichs contains 312 raster lines).
- ' The short frame is a bit lower than a long frame. If we scroll in the right
- ' moment, the scroller seems to be pushed up one by half a line.
- ' This results in a super smooth scroller.
- Set Rainbow 0,0,16,"","",""
- For A=0 To 15
- Rain(0,A)=$2204
- Next
- ' Now redirect the colour to the BPLCON0 register.
- ' (BPLCON0=$100 -> ($100-$180)/2=-64
- Extension_8_1330 0,-64
- ' Bring the interlace-rainbow to the screen.
- Rainbow 0,0,Y Hard(-1),260
- ' BP is the counter for the current letter in the scrolltext.
- BP=1
- Repeat
- ' We draw one letter.
- Gosub PULET
- ' And then we look for the right interlace frame. If did not check for the
- ' long frame, we would end up in some rather flickery mess.
- If Deek($DFF004) and $8000 Then Wait Vbl
- ' Draw a second one. We must do that, because a line can hold up to
- ' 22 letters, but there are only 16 steps between each line.
- Gosub PULET
- ' Scroll up a line and wait for the long frame.
- Add YPOS,1,0 To 287
- Screen Offset 0,0,YPOS+24
- Wait Vbl
- Until Inkey$=Chr$(27) or Mouse Key<>0
- ' The quitting check has been inserted for TV-Users. On TVs, when exiting
- ' from a interlace screen mode, the last frame must be a long frame.
- ' Or the normal non-interlaced screen will be a little bit corrupted.
- ' I know that, because I currently use a TV instead of a monitor.
- If Deek($DFF004) and $8000 Then Wait Vbl
- ' Turn interlace off and close the screen.
- Rainbow Del : View
- Screen Close 0
- End
- ' The following subroutine pastes a letter onto the screen.
- ' It has been very split up into various pieces to spread the processor
- ' power onto serveral stages.
- PULET:
- ' Get the Text-Line for the current position.
- YP=YPOS and $FFF0
- ' Check if we have scrolled into the next line. Yes? Then reset the
- ' counter LP.
- If(YPOS and 15)=0 Then LP=0
- ' The first line will be used to calculate the new x position of the
- ' text line.
- If LP=0
- XP=184
- For A=BP To Len(T$)
- Exit If Mid$(T$,A,1)="$"
- Add XP,-8
- Next
- Inc LP : Return
- End If
- ' Clear the old upper text line.
- If LP=1
- Ink 0 : Bar 0,YP To 351,YP+15
- Inc LP : Return
- End If
- ' Clear the old lower text line.
- If LP=2
- Ink 0 : Bar 0,YP+288 To 351,YP+303
- Inc LP : Return
- End If
- ' Draw a letter both in upper and lower text line.
- If LP=3
- P=Asc(Mid$(T$,BP,1))
- Add BP,1,1 To Len(T$)
- If P=36
- LP=-1
- Else
- Put Block P-31,XP,YP
- Put Block P-31,XP,YP+288
- Add XP,16
- End If
- End If
- Return